import React from 'react';
import '../../styles/liuhuan/title.scss'
import { Button, } from 'antd';
// 传入的参数进行类型声明
interface Props{
    title:string,
    btns?:btns, 
}
// 传入的对象内的属性进行类型声明
interface btns{
    btn1:string,
    btn2:string,
}

function Title(props:Props) {
    console.log(props.btns);
    // 解构传入的数据
    let { title,btns} = props
    return (
        <div className='title'>
                <h2>{title}</h2>
                <div className='left'>
                    {/*判断是否传入按钮 */}
                    {
                        btns &&
                        btns  ?
                        <>
                        <Button type="primary" >{btns.btn1}</Button>
                        <Button type="primary" >{btns.btn2}</Button>
                        </>
                        : ''
                    }
                </div>
        </div>
    );
}

export default Title;